<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>电子签</title>
    <link rel="stylesheet" href="./style/vgui-dialog.css">
    <link rel="stylesheet" href="./style/reset.css">
    <link rel="stylesheet" href="./style/index.css">
    <script src="./js/flex.min.js"></script>
    <script src="./js/zepto.js"></script>
    <script src="./js/vgui-dialog.js"></script>
    <style id="loading_style">
        .push_dialog_content .push_dialog {
            background: none;
        }
    </style>
</head>

<body class="enter">
    <div class="banner">
        <img src="./images/banner@2x.png">
    </div>
    <div class="applocation">
        <a class="item" href="./elecontract/list.html">
            <i class="icon">
                  <img src="./images/electron1.png">
              </i> 电子合同
        </a>
        <a class="item" href="./elecertificate/list.html">
            <i class="icon">
                  <img src="./images/electron3.png">
              </i> 电子证明
        </a>
        <a class="item" href="./electronfile/list.html">
            <i class="icon">
                  <img src="./images/electron2.png">
              </i> 文件签章
        </a>
        <a class="item" href="./authPage/index.html">
            <i class="icon">
                  <img src="./images/sign@2x.png">
              </i> 个人认证
        </a>
    </div>

    <script type="text/javascript">
        (function() {
            /**优化体验使用预加载大图避免闪烁亮瞎眼睛**/
            var img = new Image();
            img.src = "./images/banner@2x.png";
            img.onload = function() {
                document.body.className += " ani";
            }
            img.onerror = function() {
                    document.body.className += " ani";
                }
                /**超时处理**/
            setTimeout(function() {
                document.body.className = (document.body.className.replace("ani", "") + " ani");
            }, 500);

            function getUrlParam(name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null)
                    return decodeURI(r[2]);
                return null;
            }

            try {
                !!getUrlParam("tenantId") && sessionStorage.setItem("tenant_id", getUrlParam("tenantId"));
                !!getUrlParam("staffNo") && sessionStorage.setItem("staff_no", getUrlParam("staffNo"));
                !!getUrlParam("ownid") && sessionStorage.setItem("ownid", getUrlParam("ownid"));
            } catch (error) {
                console.log(error + "错误");
            }
            var unionId = getUrlParam("unionId");
            if (unionId && unionId !== "") {
                return
            }
            var loading = vgui.PushDialog.loading("加载中")
            $.ajax({
                url: "/electronic/judgementRegistered",
                type: "GET",
                cache: false,
                data: {
                    tenant_id: sessionStorage.getItem("tenant_id"),
                    loginUserCode: sessionStorage.getItem("staff_no"),
                    userId: sessionStorage.getItem("ownid")
                },
                success: function(res) {
                    try {
                        if (res.result == true) {
                            if (res.data.status == false) {
                                vgui.PushDialog.open({
                                    content: '<div><div class="alert_title"><svg t="1629363692957" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7180" width="30" height="30"><path d="M512.3 746.1c-10.8 0-19.5-8.7-19.5-19.5v-58.4c0-10.8 8.7-19.5 19.5-19.5s19.5 8.7 19.5 19.5v58.4c0 10.8-8.7 19.5-19.5 19.5zM512.3 590.2c-10.8 0-19.5-8.7-19.5-19.5V239.6c0-10.8 8.7-19.5 19.5-19.5s19.5 8.7 19.5 19.5v331.2c0 10.7-8.7 19.4-19.5 19.4z" fill="#FF7878" p-id="7181"></path><path d="M512.3 103.2c225.6 0 409.1 183.5 409.1 409.1 0 225.6-183.5 409.1-409.1 409.1S103.2 737.9 103.2 512.3c0-225.6 183.5-409.1 409.1-409.1m0-39c-247.5 0-448.1 200.6-448.1 448.1 0 247.5 200.6 448.1 448.1 448.1 247.5 0 448.1-200.6 448.1-448.1 0-247.5-200.7-448.1-448.1-448.1z" fill="#FF7878" p-id="7182"></path></svg>提示</div>您还未进行实名认证和授权，为避免后续无法签章，请先进行实名认证和授权</div>',
                                    btn: ["忽略", "立即认证"],
                                    btnFun: [function() {

                                    }, function() {
                                        window.location.href = "./authPage/index.html";
                                    }]
                                }, "confirm");
                            } else {
                                if (res.data.authorize == false) {
                                    vgui.PushDialog.open({
                                        content: '<div><div class="alert_title"><svg t="1629363692957" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7180" width="30" height="30"><path d="M512.3 746.1c-10.8 0-19.5-8.7-19.5-19.5v-58.4c0-10.8 8.7-19.5 19.5-19.5s19.5 8.7 19.5 19.5v58.4c0 10.8-8.7 19.5-19.5 19.5zM512.3 590.2c-10.8 0-19.5-8.7-19.5-19.5V239.6c0-10.8 8.7-19.5 19.5-19.5s19.5 8.7 19.5 19.5v331.2c0 10.7-8.7 19.4-19.5 19.4z" fill="#FF7878" p-id="7181"></path><path d="M512.3 103.2c225.6 0 409.1 183.5 409.1 409.1 0 225.6-183.5 409.1-409.1 409.1S103.2 737.9 103.2 512.3c0-225.6 183.5-409.1 409.1-409.1m0-39c-247.5 0-448.1 200.6-448.1 448.1 0 247.5 200.6 448.1 448.1 448.1 247.5 0 448.1-200.6 448.1-448.1 0-247.5-200.7-448.1-448.1-448.1z" fill="#FF7878" p-id="7182"></path></svg>提示</div>您还未进行实名认证和授权，为避免后续无法签章，请先进行实名认证和授权</div>',
                                        btn: ["忽略", "认证授权"],
                                        btnFun: [function() {}, function() {
                                            window.location.href = "./authPage/index.html";
                                        }]
                                    }, "confirm");
                                } else {
                                    if (res.data.joinCompany == false) {
                                        vgui.PushDialog.open({
                                            content: '<div><div class="alert_title"><svg t="1629363692957" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7180" width="30" height="30"><path d="M512.3 746.1c-10.8 0-19.5-8.7-19.5-19.5v-58.4c0-10.8 8.7-19.5 19.5-19.5s19.5 8.7 19.5 19.5v58.4c0 10.8-8.7 19.5-19.5 19.5zM512.3 590.2c-10.8 0-19.5-8.7-19.5-19.5V239.6c0-10.8 8.7-19.5 19.5-19.5s19.5 8.7 19.5 19.5v331.2c0 10.7-8.7 19.4-19.5 19.4z" fill="#FF7878" p-id="7181"></path><path d="M512.3 103.2c225.6 0 409.1 183.5 409.1 409.1 0 225.6-183.5 409.1-409.1 409.1S103.2 737.9 103.2 512.3c0-225.6 183.5-409.1 409.1-409.1m0-39c-247.5 0-448.1 200.6-448.1 448.1 0 247.5 200.6 448.1 448.1 448.1 247.5 0 448.1-200.6 448.1-448.1 0-247.5-200.7-448.1-448.1-448.1z" fill="#FF7878" p-id="7182"></path></svg>提示</div>您还未进行实名认证和授权，为避免后续无法签章，请先进行实名认证和授权</div>',
                                            btn: ["忽略", "认证授权"],
                                            btnFun: [function() {}, function() {
                                                window.location.href = "./authPage/index.html";
                                            }]
                                        }, "confirm");
                                    }
                                }
                            }
                        } else {
                            vgui.PushDialog.alert(res.msg, "知道了");
                        }
                    } catch (e) {
                        vgui.PushDialog.alert("请求错误");
                    }

                },
                complete: function(xhr) {
                    vgui.PushDialog.close(loading);
                    $('#loading_style').remove();
                    if (xhr.status !== 200) {
                        vgui.PushDialog.alert("网络错误");
                    }
                }
            })

        })();
    </script>
</body>

</html>